﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BonjourHotel.Core.Localization;
using BonjourHotel.Core.Cache;
using Telerik.Web.UI;

namespace BonjourHotel.Application.Controls.StatusBar
{
    public partial class ResetCache : System.Web.UI.UserControl
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            lbReset.Text = LocaleManager.GetLocaleString("StatusBar.ResetCache.Reset");
        }

        protected void TryResetCache(object sender, EventArgs e)
        {
            try
            {
                CacheManager.Clear();
                string successMessage = LocaleManager.GetLocaleString("StatusBar.ResetCache.ResetOk");
                RadAjaxManager.GetCurrent(this.Page).Alert(successMessage);
            }
            catch (Exception exp)
            {
                string failureMessage = LocaleManager.GetLocaleString("StatusBar.ResetCache.ResetKo");
                RadAjaxManager.GetCurrent(this.Page).Alert(failureMessage);
            }
            
        }
    }
}